﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Shoot : MonoBehaviour
{
    //public GameObject Prefab_Ball;

    public float timerCount;
    public float timer = 0;

    //public Transform born;

    void Start()
    {
        
    }

    void Update()
    {
        timer += Time.deltaTime;
        if (timer >= timerCount)
        { 
            timer = 0;

            GameObject go = Instantiate(GameManager.Instance.Prefab_Ball, Vector3.zero, Quaternion.identity);
            go.transform.position = this.transform.position;
            Ball ball = go.GetComponent<Ball>();
            ball.colorType = (ColorType)Random.Range(0, 3);
            ShuaiFunction.Refresh(ball.sp, ball.colorType);

            ball.speed = Random.Range(2f, 8f);
        }
    }
}
